﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

using LeanEngine.Extensions;

namespace LeanEngine.Collections
{
    /// <summary>
    /// Extension methods for System.Collections.IList.
    /// </summary>
    public static class ICollectionExtensions
    {
        /// <summary>
        /// Checks whether the collection is not null and if you have items.
        /// </summary>
        public static bool IsNotNullOrEmpty(this IList source)
        {
            return (source != null && (source.Count.IsGreaterThan(0)));
        }

        /// <summary>
        /// Checks whether the collection is null or is empty.
        /// </summary>
        public static bool IsNullOrEmpty(this IList source)
        {
            return (source != null || (source.Count.IsLessThan(1)));
        }
    }
}
